package com.hailong.hadoop.rpc.writable.server;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import com.hailong.hadoop.rpc.writable.protocol.ClientProtol;

/**
 * Created by 31464 on 2021/12/13.
 */
public class HDFSRPCServer implements ClientProtol {


    public static void main(String[] args) throws Exception{
        RPC.Server server = new RPC.Builder(new Configuration())
                .setBindAddress("localhost")
                .setPort(8888)
                .setProtocol(ClientProtol.class)
                .setInstance(new HDFSRPCServer())
                .build();

        System.out.println("服务器启动");

        server.start();

    }

    public void sayHello(String word) {
        System.out.println("服务器响应：Hello,"+word);
    }
}
